<?php
	header("Content-Type: text/html;charset=utf-8");
	include("function/_nosql.php");
	include("function/function.php");
	$URL = $_SERVER['REQUEST_URI'];
	$newsid = trim($_REQUEST['newsid']);
	if(is_numeric($newsid)){
		$sql="select * from kboy_forum_travel where id=$newsid";
		$rows=mysql_query($sql);
		$nums=mysql_num_rows($rows);
		if($nums>0){
			$rs=mysql_fetch_array($rows);
				$news_id = $rs['id'];
				$news_title = $rs['travel_title'];
				$news_pic = $rs['travel_pic'];
				$news_bigclass = $rs['travel_bigclass'];
				$classid = $rs['travel_bigclass'];
				$news_addtime = $rs['travel_addtime'];
				$news_content = stripslashes($rs['travel_content']);
				$news_hit = $rs['travel_hit'];
				$classid = $rs['travel_bigclass'];
				$uid = $rs['uid'];
		}else{
			echo erro("该信息已被删除或不存在?");
		}
	}else{
		echo erro("该信息已被删除或不存在!");
	}
	
	$sql="select * from kboy_bigclass where id=$news_bigclass";
	$rows=mysql_query($sql);
	$nums=mysql_num_rows($rows);
	if($nums>0){
		$rs=mysql_fetch_array($rows);
		$bigclass_cn = $rs['bigclass_cn'];
		
	}else{
		echo erro("该信息已被删除或不存在!!");
	}
	
	if($news_tourls){ // 设置转页
		echo "<meta http-equiv=\"Refresh\" content=\"0;URL=".$news_tourls."\" />";
		echo re($news_tourls);
	}
	
	// 获取父ID串
	$replace_str = "1,2,3";
	getFatherID($classid,"");
	$getFatherID = $getFatherID . ",";
	$EXarr = explode(',',$replace_str);
	foreach($EXarr as $u){
		$rep_str = ','.$u.",";
		$getFatherID = str_replace($rep_str,'',$getFatherID);
	}
	$getFatherID = rtrim(ltrim($getFatherID,','),',');
	if(strlen($getFatherID)>0){
		$Farr = array_reverse(explode(",",$getFatherID));
		$FarrNum = $Farr[0];
	}
	mysql_query("update kboy_forum_travel set travel_hit = travel_hit + 1 where id=$newsid");
		//这段放在网站里


header("Pragma: no-cache");

$ua = strtolower($_SERVER['HTTP_USER_AGENT']);

$uachar = "/(symbianos|android|Mac OS|ucweb|blackberry)/i";

if($ua != '' && preg_match($uachar, $ua)){

echo '<script>window.location.href="http://www.chinawalking.net.cn/sj/shequ-t.php?newsid='.$newsid.'";</script>';

exit();

}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?= $news_title ?>_<?= $web_titles?></title>
<meta name="Keywords" content="<?= $news_title ?>,<?= $web_keywords ?>" />
<meta name="Description" content="<?= $web_description ?>" />
<link rel="stylesheet" href="css/common.css"/>
<link rel="stylesheet" href="css/sq.css"/>
<link rel="stylesheet" type="text/css" href="css/sinaFaceAndEffec.css" />
<script type="text/javascript" src="js/baidutongji.js"></script>
<script type="text/javascript" src="js/laydate/laydate.js"></script>
</head>
<body>
    <!--top-bar begin-->
	<? include("_include.top.topbar.php") ?>
    <!--top-bar end-->
    <!--header begin-->
	<? include("_include.top.navbar.php") ?>
    <!--header end-->
    <!--banner begin-->
    <div class="sq-banner">
        <div class="inner-pic"><img src="images/sq_ban.jpg" alt=""/></div>
        <div class="sq-inner">
            <div class="search-box">
            </div>
				<?php
						if($_SESSION['kboy_userid']){
							$urls = "forum_travel_add.php?uid=".$_SESSION['kboy_userid'];
						}else{
							$urls = "login.php";
						}
				?>
            <div class="sq-1"><a href="<?=$urls?>">我要发贴 <i><img src="images/rect2.png" width="12" height="9" alt=""/></i></a></div>
            <div class="sq-1"><a href="user_index.php">个人中心</a></div>
        </div>
    </div>
    <!--banner end-->
    <!--活动 begin-->
    <div class="f-item-box np">
        <div class="content">
            <div class="sq-d-crumb">
                <div class="sq-d"><a href="#"><?=$bigclass_cn?></a></div>
                <!--<div class="sq-new-t"><a href="#post-mess-box"><i><img src="images/wr1.png" width="19" height="19" alt=""/></i>回复</a></div>-->
            </div>
            <div class="sq-d-inner">
                <div class="sq-d-title">
                    <h3><?=$news_title?></h3>
                    <div class="editor-inner">
                        <span class="editor">作者：<a href="forum_active.php?uid=<?=$uid;?>"><?=getUserNickName($uid)?></a></span>
                        <span class="date">发表于：<?=$news_addtime?></span>
                        <div class="show-pl"><span class="watch"><i></i><?=$news_hit;?></span></div>
                    </div>
                    <div class="tx"><a href="forum_active.php?uid=<?=$uid;?>"><img src="<?=getClassName("kboy_user","user_face","uid=".$uid)?>" width="84" height="84" alt=""/></a></div>
                </div>
                <div class="sq-d-bd">
                    <div class="sq-d-l">
                        <div class="d-con">
							<?=$news_content?>
                        </div>
						
						<!--评论代码-->
						<div class="sq-bd-l1">
                    <div class="post-container"  name="container_tiezi"  id="container_tiezi" >
					
					
						<input type="hidden" name="tid" value="<?php echo $newsid;?>" />
							<div class="sq-editor-cont">
								<div class="sq-editor-text">
									<textarea contenteditable="true" class="textarea text1" name="strhtml" placeholder="说点什么吧..."></textarea>
								</div>
								<div class="sq-editor-ft">
									<div class="sq-editor-attach">
										<ul>
											<li><a href="javascript:;">表情<span class="face-icon1" style="font-size: 22px;font-family: '微软雅黑';" >☺</span></a></li>
											<li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
										</ul>
									</div>
									<div class="sq-editor-op"><a href="javascript:;" onclick="out()" class="btn-post"><i class="icon icon-post"></i>发 表</a></div>
								</div>
								<div class="sq-editor-pics">
									<ul class="clearfix">
									</ul>
								</div>
							</div>
					
					
                       
                    </div>
                    
                    <div class="fn-feed-container">
                        <div class="feed-inner">
                            <ul class="feed_friend_list">
							<?php
								$SQL = "";
								$pagesize = 10; // 分页数量
								$pageval = chkstr(trim($_REQUEST['page'])); // 获取Page的值
								if($pageval){
									if(!is_numeric($pageval)){
										echo erro("Page Error");
									}
									if($pageval <= 1){
										$pageval = 1;
									}
									$page = ($pageval-1) * $pagesize;
									$page .= ",";
								}else{
									$pageval = 1;
								}
								
								$pagesql = "select * from kboy_forum_travel_message where tid=$newsid  and pid = 0 order by id desc";
								$pagenum = mysql_num_rows(mysql_query($pagesql)); // 总记录数
								$pagecount = ceil($pagenum/$pagesize); // 共分多少页
								if($pageval > $pagecount){
									$pageval = $pagecount;
								}
								
								$news_sql = $pagesql." limit $page $pagesize";
								$news_rows = mysql_query($news_sql);
								$i = 1;
								while($news_rs = mysql_fetch_assoc($news_rows)){
								
									$content = json_decode($news_rs['news_text']);
								//	var_dump($content);
							?>
                                <li class="f-single">
                                    <div class="f-aside">
                                        <div class="f-user-pto">
                                            <a href="forum_news.php?uid=<?=$news_rs['uid']?>" target="_blank">
											
												<?php
													$pic = getClassName('kboy_user','user_face','uid='.$news_rs['uid']);
													if($pic){
														$member_pic = $pic;
													}else{
														$member_pic = "images/lvyou.jpg";
													} 
												?>
                                            <img src="<?php echo $member_pic;?>" width="58" height="58" alt=""/>
                                               
                                            </a>
                                        </div>
                                        <div class="f-user-info">
                                            <div class="f-nick"><a href="forum_news.php?uid=<?=$news_rs['uid']?>"><?php if($news_rs['uid'] == 0){echo $news_rs['youkeip']."游客";}else{ echo getUserNickName($news_rs['uid']);} ?></a></div>
                                            <div class="info-detail">
                                                <span class="time"><?php echo $news_rs['news_addtime']?></span>
                                               <!-- <span class="state"><i class="icon-browse"></i>浏览(0)</span>-->
                                            </div>
                                        </div>
                                    </div>
                                    <div class="f-wrap">
                                        <div class="f-item">
                                            <div class="f-info"><?php echo $news_rs['news_text'];?></div>
                                            <div class="sq_summary">
												<?php
													if(count($content->images)){
												?>
													<div class="f-ct">
														<div class="img-box-wrap">
															<div class="img-box">
																<?php
																
																	foreach($content->images as $v){
																		echo "<a href='javascript:;' class='img-two'><img src='".$v."' /></a>";
																	}
																?>
																
															</div>
														</div>
													</div>
												<?php
													}
												?>
                                                <div class="f-op-wrap">
                                                    <div class="f-detail">
													<?php
														$soon = "";
														$getSoonIDList = "";
														getSoonIDList($news_rs['id'],'kboy_forum_travel_message');
														$soon = ltrim($getSoonIDList,',');
													?>
                                                        <a class="f-detail-comment" href="javascript:void(0);"><i class="ui-icon icon-comment"></i>回复(<?php if($soon) {echo count(explode(',',$soon));}else{echo 0;} ?>)</a>
                                                        <a class="f-detail-praise" href="forum_travel_zandel.php?action=dianzan&id=<?=$news_rs['id']?>" data-id="<?php echo $news_rs['id']?>" ><i class="ui-icon icon-praise"></i>赞(<span class="num"><?=$news_rs['news_good']?></span>)</a>
<!--                                                        <a class="f-detail-collect" href="server/test.php?action=shoucang"><i class="ui-icon icon-collect"></i>收藏</a>
-->                                                        <?php 
															if($kboy_userid == $uid){
																echo "<a class='f-detail-delete' href='forum_travel_zandel.php?action=shanchu&id=".$news_rs['id']."'  ><i class='ui-icon icon-delete'></i>删除</a>";
															}
															
														?>
                                                    </div>
                                                    <!--<div class="f-like">
                                                        <div class="icon-btn">
                                                            <a href="javascript:;" class="praise"><i class="icon-praise"></i></a>
                                                        </div>
                                                        <div class="user-list">
                                                        </div>
                                                    </div>-->
													<?php
														if(getNewsNums('kboy_forum_travel_message',"pid = ".$news_rs['id'])){
													?>
                                                    <div class="mod-comments">
													
                                                        <div class="comments-list ">
                                                            <ul>
																<?php
																	$com_sql = "select * from kboy_forum_travel_message where pid = ".$news_rs['id'];
																	$com_re = mysql_query($com_sql);
																	while($com_arr = mysql_fetch_assoc($com_re)){
																	
																?>	
                                                                <li class="comments-item bor3">
                                                                    <div class="comments-item-bd">
                                                                        <div class="ui-avatar">
                                                                            <a href="forum_news.php?uid=<?php echo $com_arr['uid'];?>" target="_blank">
																			<?php
																				$pic = getClassName('kboy_user','user_face','uid='.$com_arr['uid']);
																				if($pic){
																					$member_pic = $pic;
																				}else{
																					$member_pic = "images/lvyou.jpg";
																				}
																			?>
                                                                                <img class="q_namecard" src="<?php echo $member_pic;?>"> 
                                                                               
                                                                            </a>
                                                                        </div>
                                                                        <div class="comments-content">
                                                                            <a class="c_tx" target="_blank" href="forum_news.php?uid=<?php echo $com_arr['uid'];?>"><?php if($com_arr['uid'] == 0){echo $com_arr['youkeip']."游客"; }else{ echo getUserNickName($com_arr['uid']);} ?></a>&nbsp; : <?php echo $com_arr['news_text'];?>
                                                                            <div class="comments-op">
                                                                                <span class=" ui-mr10 state"><?php echo $com_arr['news_addtime'];?></span>
                                                                                <a class="act-reply" href="javascript:;"><b class="hide-clip">回复</b></a> 
																				<!--
                                                                                <a class="act-delete none" href="server/test.php?action=delchildmsg"><b class="hide-clip">删除</b></a>
																				-->
                                                                            </div>
                                                                        </div>
                                                                        <div class="comment-box-wrap">
																			<input type="hidden" name="tid" value="<?php echo $newsid;?>" />
																				<div class="sq-editor-cont">
																					<div class="sq-editor-text">
																						<textarea contenteditable="true" class="textarea text2" name="strhtml" placeholder="说点什么吧..."></textarea>
																					</div>
																					<div class="sq-editor-ft">
																						<div class="sq-editor-attach">
																							<ul>
																								<li><a href="javascript:;">表情<span class="face-icon2" style="font-size: 22px;font-family: '微软雅黑';" >☺</span></a></li>
																								<li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
																							</ul>
																						</div>
																						<div class="sq-editor-op">
																							<input type="hidden" name="sonid" value="<?php echo $com_arr['id'];?>" />
																							<input type="button" value="发表" class='btn-post reply1' >
																						</div>
																					</div>
																				</div>
                                                                        </div>
                                                                        <?php echo getComList($com_arr['id'],'kboy_forum_travel_message','forum_travelsave.php');?>
                                                                    </div>
                                                                </li>
																<?php	
																	}
																?>
																
                                                            </ul>
                                                         </div>
														 <?php	
															}
														?>
                                                        <div class="mod-commnets-poster">
                                                            <div class="comments-box" >
                                                                <div class="text-input"><a href="javascript:;" class="sq-tx">我也说一句</a></div>
                                                                <div class="mod-insert-mess"><a href="javascript:;"><i class="icon icon-mess"></i></a></div>
                                                            </div>
                                                            <div class="comment-box-wrap">
																<input type="hidden" name="tid" value="<?php echo $newsid;?>" />
																
                                                                    <div class="sq-editor-cont">
                                                                        <div class="sq-editor-text">
                                                                            <textarea contenteditable="true" class="textarea text3" name="strhtml" placeholder="说点什么吧..."></textarea> 
                                                                        </div>
                                                                        <div class="sq-editor-ft">
                                                                            <div class="sq-editor-attach">
                                                                                <ul>
                                                                                	<li><a href="javascript:;">表情<span class="face-icon3" style="font-size: 22px;font-family: '微软雅黑';" >☺</span></a></li>
                                                                                    <li><a class="btn-link-append" href="javascript:;">超链接<i class="icon icon-link"></i></a></li>
                                                                                </ul>
                                                                            </div>
                                                                            <div class="sq-editor-op">
                                                                            	<input type="hidden" name="id" value="<?php echo $news_rs['id'];?>" />
                                                                            	<a href="javascript:void(0)" class="btn-post reply2">发表</a>
                                                                            </div>
                                                                        </div>
                                                                    </div>
                                                            </div>
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                    </div>
                                </li>
							<?php
								}
							?>
								
                            </ul>
                            <!-- <div class="s-watch-more">
                                <a href="javascript:;">
                                    <span>查看更多</span>
                                    <i></i>
                                </a>
                            </div> -->
										<?php
												if($pagenum > $pagesize){
													echo "<div class=\"pagination\"><ul>";
													$url = "forum_travelview.php?newsid=$newsid";//当前页面
													pagebar($pagecount, $pageval, 7, $url);
													echo "</ul></div>";
												}
										?>
								
                                   

                        </div>
						
						
						
                        <div class="d-tz">
                            <div class="title">相关贴子</div>
                            <ul class="d-tz-list">
							<?php
								$news_sql = "select * from kboy_forum_travel where id not in (".$newsid.")  order by id desc limit 20";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
							?>
                                <li>
                                    <a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank">
                                        <div class="pic">
                                            <img src="<?=$news_rs['travel_pic']?>" width="160" height="115" alt=""/>
                                        </div>
                                        <div class="info">
                                            <p class="name" style="overflow: hidden;"><?=$news_rs['travel_title']?></p>
                                            <p class="date"><?=date('Y-m-d',strtotime($news_rs['travel_addtime']))?></p>
                                        </div>
                                    </a>
                                </li>
							<?php
								}
							?>
                            </ul>
                        </div>
						
						
						
						
                    </div>
                </div>

                        <!--评论代码结束-->
                        
                    </div>
                    <div class="sq-d-r">
                        <div class="sq-d-item">
                            <div class="title"><h3>本周热门</h3><a href="bbs.php" class="more">更多&gt;&gt;</a></div>
                            <div class="sq-r-box">
							<?php
								$date=date('Y-m-d');  //当前日期

                                        $first=1; //$first =1 表示每周星期一为开始日期 0表示每周日为开始日期

                                        $w=date('w',strtotime($date));  //获取当前周的第几天 周日是 0 周一到周六是 1 - 6 

                                        $now_start=date('Y-m-d',strtotime("$date -".($w ? $w - $first : 6).' days')); //获取本周开始日期，如果$w是0，则表示周日，减去 6 天

                                        $now_end=date('Y-m-d',strtotime("$now_start +6 days"));  //本周结束日期



                                        $news_sql = "select * from kboy_forum_travel where (date(travel_addtime)>='$now_start' and date(travel_addtime)<='$now_end') order by travel_hit desc limit 3";
										
                                        $news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
							?>
                                <dl>
                                    <dt><a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><img src="<?=$news_rs['travel_pic']?>" width="103" height="73" alt=""/></a></dt>
                                    <dd>
                                        <div class="r-t"><a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><?=$news_rs['travel_title']?></a></div>
                                        <div class="r-w"><p class="date"><?=date('Y-m-d',strtotime($news_rs['travel_addtime']))?></p></div>
                                    </dd>
                                </dl>
							<?php
								}
							?>
                            </div>
                        </div>
                        <div class="sq-d-item">
                            <div class="title"><h3>最新帖子</h3><a href="bbs.php" class="more">更多&gt;&gt;</a></div>
                            <div class="sq-r-box">
							<?php
								$news_sql = "select * from kboy_forum_travel order by id desc limit 3";
								$news_rows = mysql_query($news_sql);
								while($news_rs = mysql_fetch_array($news_rows)){
							?>
                                <dl>
                                    <dt><a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><img src="<?=$news_rs['travel_pic']?>" width="103" height="73" alt=""/></a></dt>
                                    <dd>
                                        <div class="r-t"><a href="forum_travelview.php?newsid=<?=$news_rs['id']?>" target="_blank"><?=$news_rs['travel_title']?></a></div>
                                        <div class="r-w"><p class="date"><?=date('Y-m-d',strtotime($news_rs['travel_addtime']))?></p></div>
                                    </dd>
                                </dl>
							<?php
								}
							?>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!--foot begin-->
	<? include("_include.bottom.footbar.php") ?>
    <!--foot begin-->
    <!--左侧悬浮 begin-->
	<? include("_include.bottom.leftbar.php") ?>
    <!--左侧悬浮 end-->
    <!--右侧悬浮导航 begin-->
	<? include("_include.bottom.rightbar.php") ?>
    <!--右侧悬浮导航 end-->
    <script type="text/javascript" src="js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript" src="js/jquery.SuperSlide.2.1.1.js"></script>
	<script type="text/javascript" src="layer/layer.js"></script>
    <script type="text/javascript" src="piclayer/piclayer.min.js"></script>
    <script type="text/javascript" src="js/main.js"></script>
    <script type="text/javascript" src="js/sq.js"></script>
    <script type="text/javascript" src="js/sinaFaceAndEffec.js"></script>
<script type="text/javascript">
	// 绑定表情
	$('.face-icon1').SinaEmotion($('.text1'));
	// 测试本地解析
	var a = 1;
	function out() {
		if(a==1){
			a=2;
			var inputText = $('.text1').val();
			var atext = AnalyticEmotion(inputText);
			if(atext.replace(/\ /g,"").length<1){
				atext = inputText;
			} 
			var tid = $("input[name=tid]").val();
			$.ajax({
				type:"post",
				url:"forum_travelsave.php?action=add",
				data:{strhtml:atext,tid:tid},
				dataType:"json",
				success:function(data){
					if(data == 1){
						history.go(0);
					}
				}
			});
		}
		
	}
	
</script>
<script type="text/javascript">
	var a = 1;
	// 绑定表情
	$('.face-icon2').SinaEmotion($('.text2'));
	$(".reply1").click(function(){
		if(a==1){
			a=2;
			var inputText = $(this).parents(".sq-editor-ft").siblings(".sq-editor-text").find(".text2").val();
			var atext = AnalyticEmotion(inputText);
			if(atext.replace(/\ /g,"").length<1){
				atext = inputText;
			}
			var tid = $("input[name=tid]").val();
			var id = $(this).siblings("input[name=sonid]").val();
			
			$.ajax({
				type:"post",
				url:"forum_travelsave.php?action=reply",
				data:{strhtml:atext,tid:tid,pid:id}, 
				dataType:"json",
				success:function(data){
					if(data == 1){
						history.go(0);
					}
				}
			});
		}
		
	})
</script>
<script type="text/javascript">
var a=1;
	// 绑定表情
	$('.face-icon3').SinaEmotion($('.text3'));
	$(".reply2").click(function(){
		if(a==1){
			a=2;
			var inputText = $(this).parents(".sq-editor-ft").siblings(".sq-editor-text").find(".text3").val();
			var atext = AnalyticEmotion(inputText);
			if(atext.replace(/\ /g,"").length<1){
				atext = inputText;
			}
			var tid = $("input[name=tid]").val();
			var id = $(this).siblings("input[name=id]").val();
			
			$.ajax({
				type:"post",
				url:"forum_travelsave.php?action=reply",
				data:{strhtml:atext,tid:tid,pid:id}, 
				dataType:"json",
				success:function(data){
					if(data == 1){
						history.go(0);
					}
				}
			});
		}
		
	})
</script>
</body>
</html>





















